Rule.identical = function( value , param ) 
{
	return ( value == param );
};

Rule.notIdentical = function( value , param ) 
{
    return ( value != document.getElementById(param).value );
};


Rule.hostname = function( value )
{
    if( !value ){
    	return true;
    }
    // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
    return RegExp("^" + IRI + "$", "i").test(value);
};

Rule.emailAddress = function( value )
{
    if( !value ){
    	return true;
    }
    var status = true;
    var pattern = null;
    pattern = new RegExp(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/);
    status = pattern.test( value ) ? status : false;
    pattern = new RegExp(/^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/);
    status = pattern.test( value ) ? status : false;
    pattern = new RegExp(/^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/);
    status = pattern.test( value ) ? status : false;
    return status;
};

Rule.minlength = function( value, length ) 
{
    return value.length >= parseInt( length );
};

Rule.maxlength = function( value, length ) 
{
    return value.length <= parseInt( length );
};

Rule.stringLength = function( value, min, max ) 
{
    return ( value.length >= parseInt( min ) && value.length <= parseInt( max ) );
};

Rule.accept = function( value, param ) 
{
    param = typeof param == "string" ? param : "png|jpe?g|gif";
    return  value.match( new RegExp(".(" + param + ")$", "i") );
}